package org.jader.bolao.gui.swing.table;

import org.jader.bolao.GameIndividual;
import org.jader.bolao.GamePlayer;

public class GameIndividualPlayersTableModel extends GamePlayersTableModel {
	private static final long serialVersionUID = 1L;

	private GameIndividual game = null;
	
	public GameIndividualPlayersTableModel(GameIndividual game) {
		super();
		this.game = game;
	}

	@Override
	public GamePlayer getPlayerByRow(int row) {
		return game.getPlayer(row);
	}

	@Override
	protected COLUMNS getColumnByNumber(int col) {
		COLUMNS cols = null;
		switch(col) {
		case 0:
			cols = COLUMNS.POSITION;
			break;
		case 1:
			cols = COLUMNS.PLAYER;
			break;
		case 2:
			cols = COLUMNS.TEAM;
			break;
		case 3:
			cols = COLUMNS.POINTS;
			break;
		case 4:
			cols = COLUMNS.DETAILED;
			break;
		}
		return cols;
	}

	@Override
    public int getRowCount() {
    	if (game == null) return 0;
    	return game.numberOfPlayers();
    }

	@Override
    public int getColumnCount() {
    	return 5;
    }
}
